import request from '@/utils/request'

// 获取文章分类列表
export const getCateListAPI = () => {
  return request.get('/my/cate/list')
}

// 新增文章分类
export const addAPI = (obj) => {
  return request.post('/my/cate/add', obj)
}

// 根据 Id 更新文章分类数据
export const putAPI = (obj) => {
  return request.put('/my/cate/info', obj)
}

// 根据 Id 删除文章分类export const putAPI = (obj) => {
export const delAPI = (id) => {
  return request.delete('/my/cate/del', { params: { id } })
}

// 发布新文章
// 形参中的fd是FormData格式的请求体对象、
// export const addArticleAPI = (fd) => request.post('/my/article/add', fd)// 简写去掉return和对象
// export const addArticleAPI = (fd) => {
//   return request.post('/my/article/add', fd)
// }
export const pubArticleAPI = (fd) => request.post('/my/article/add', fd)

// 获取文章的列表数据
export const articleAPI = (q) => request.get('/my/article/list', { params: q })

// 根据 Id 获取文章详情
export const articleInfoAPI = (id) => request.get('/my/article/info', { params: { id } })

// 根据 Id 删除文章数据
export const removeAPI = (id) => request.delete('/my/article/info', { params: { id } })
